<!DOCTYPE html>

<html><head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>CRUD示例</title>
	<script src="//cdn.bootcss.com/angular.js/1.5.6/angular.min.js"></script>
	<script type="text/javascript" src="js/main_ng.js"></script>
</head>

<body ng-app="app" ng-controller="MainController">
	<h2>CRUD（增加Create、查询Retrieve、更新Update、删除Delete）示例</h2>

	<table cellspacing="1" style="background-color: #a0c6e5">
		<tr><td>ID：</td>
			<td><input ng-model="id" value="1234" /></td>
		</tr>
		<tr><td>水果：</td>
			<td><input ng-model="name" value="苹果"/></td>
		</tr>
		<tr><td>价格：</td>
			<td><input ng-model="price" value="18.00"/></td>
		</tr>
	</table>
	<button ng-click="addProduct()">增加水果</button>
	<button ng-click="updateProducts()">更新水果</button>
	<button ng-click="deleteProduct()">删除水果</button>
	<br/>
	<button ng-click="getProducts()">查询水果</button>
	<br/>
	<font color="red" ng-show="message">{{message}}</font>
	<br/>

	<table>
		<thead>
		<tr>
			<th>水果</th> <th>价格</th>
		</tr>
		</thead>
		<tbody>
		<tr th:each="prod : ${products}">
			<td th:text="${prod.name}">Oranges</td>
			<td th:text="${#numbers.formatDecimal(prod.price,1,2)}">
				0.99</td>
		</tr>
		</tbody>
	</table>
</body>
</html>